import request from '@/utils/request';
import {FunctionDTO} from "@/types/function";
import {stringify} from "querystring";

export async function queryList(): Promise<any> {
  return request('/function/query_list',{
    method: 'GET',
  });
}

export async function create(params:FunctionDTO): Promise<any> {
  return request('/function/create',{
    method: 'POST',
    data: params,
  });
}

export async function modify(params:FunctionDTO): Promise<any> {
  return request('/function/modify',{
    method: 'PUT',
    data: params,
  });
}

export async function _delete(params:{id:string | number}): Promise<any> {
  return request(`/function/delete?${stringify(params)}`,{
    method: 'DELETE',
  });
}

export default {
  queryList,
  create,
  modify,
  _delete,
}
